import { createMainApp } from "./main";
// import "./iview-variables.less";
import config from "./config";
import { global } from "./libs/global";

global.BUILD_DATE = "";
global.BUILD_VERSION = "";
global.BUILD_PROFILE = "dev";

createMainApp(global.BUILD_CONFIG).then(({ app, router }) => {
	router.beforeEach((to, from, next) => {
		console.log("router to: " + to.fullPath);
		/*路由发生改变修改页面的title */
		if (to.meta.title) {
			document.title = config.siteTitle + "-" + to.meta.title;
		} else {
			document.title = config.siteTitle;
		}
		next();

		// 切换页面时滚动到顶部
		window.scrollTo(0, 0);
	});
	app.mount("#app");
});
